
define(function(){  
	var B,M,hasPokeyAudio=true;
	function _createBgAudio(mp3){
		B=document.createElement('audio');
		B.id = "bgAudio";
		B.controls=false;
		B.preload=false;
		B.loop = true;
		B.src = mp3;
		B.play();
	}

	function _createAudio(mp3){
		M=document.createElement('audio');
		M.id = "audio";
		M.controls=false;
		M.preload=false;
		M.src = mp3;
		M.play();
	}
	
	return {
		
		
		bg:function(){
			console.log("打开背景声音");
			//_createBgAudio("mp3/welcome_1.m4a");
			
		},
		
		playBg:function(){
			console.log("打开背景声音");
			B.play();
		},
		
		stopBg:function(){
			console.log("关闭背景声音");
			B.pause();
		},
		
		stopAll:function(){
			console.log("关闭所有声音");
			this.stopBg();
			this.stopPokeyAudio();
			
		},	
		
		pokeyAudio:function(){
			hasPokeyAudio = true;
			},
			
		stopPokeyAudio:function(){
			hasPokeyAudio = false;
		},
		
		
		/*准备*/
		ready:function(){
			console.log("准备声音");
			if(hasPokeyAudio){
				//_createAudio("mp3/menu.m4a");
			}
			},
			
		/*发牌*/
		get:function(){
			console.log("发牌声音");
			if(hasPokeyAudio){
				//_createAudio("mp3/start.m4a");
			}
			},
		
		/*叫分*/
		bid:function(){
			
			},
			
		/*不叫*/
		nobid:function(){
			
			},
		
		/*顺子*/
		straight:function(){
			if(hasPokeyAudio){
				//_createAudio("mp3/straight_sound.m4a");
			}
			},
			
		/*出牌*/
		put:function(){
			console.log("出牌声音");
			if(hasPokeyAudio){
				//_createAudio("mp3/da3.m4a");
			}
			},
			
		/*炸弹*/
		bomb:function(){
			console.log("炸弹声音");
			if(hasPokeyAudio){
				//_createAudio("mp3/bomb_sound.m4a");
			}
			},
		
		/*飞机*/
		plain:function(){
			console.log("飞机声音");
			if(hasPokeyAudio){
				//_createAudio("mp3/plane.m4a");
			}
			},
			
		/*火箭*/
		rocket:function(){
			if(hasPokeyAudio){
				//_createAudio("mp3/3.m4a");
			}
			},
			
		/*输了*/	
		lose:function(){
			console.log("输了声音");
			if(hasPokeyAudio){
				//_createAudio("mp3/lost.m4a");
			}
			},
			
		/*赢了*/	
		win:function(){
			console.log("赢了声音");
			if(hasPokeyAudio){
				//_createAudio("mp3/wincard.m4a");
			}
			},
		
		/*倒计时3秒提醒*/
		countDown:function(){
			if(hasPokeyAudio){
				//_createAudio("mp3/countdown_sound.m4a");
			}
			},	
			
		"double":function(){
			if(hasPokeyAudio){
				//_createAudio("mp3/double_sound.m4a");
			}
			},
			
		role:function(roleName){
			if(hasPokeyAudio){
				if(M){
					M.pause();
				}
			
				_createAudio("mp3/"+roleName+"/people.m4a");
			}
			},
			
		menu:function(){
			if(hasPokeyAudio){
				//_createAudio("mp3/menu.m4a");
			}
			}
	}
}); 